package smart.src;

import org.openswing.swing.form.client.Form;
import org.openswing.swing.internationalization.java.Resources;
import org.openswing.swing.util.java.Consts;

import java.awt.GridBagLayout;
import java.awt.Insets;

import org.openswing.swing.client.ComboBoxControl;
import org.openswing.swing.client.DateControl;
import org.openswing.swing.client.LabelControl;
import org.openswing.swing.client.NumericControl;
import org.openswing.swing.client.TextAreaControl;
import org.openswing.swing.client.TextControl;

import src.VO.ClientVO;


import java.awt.GridBagConstraints;

import javax.swing.border.TitledBorder;

public class ClientForm extends Form {
	
	private final LabelControl labelControl = new LabelControl();
	private final TextControl name = new TextControl();
	private final LabelControl labelControl_5 = new LabelControl();
	private final ComboBoxControl sexControl = new ComboBoxControl();
	private final LabelControl labelControl_1 = new LabelControl();
	private final TextControl passport = new TextControl();
	private final LabelControl labelControl_6 = new LabelControl();
	private final DateControl dateControl = new DateControl();
	private final LabelControl labelControl_2 = new LabelControl();
	private final TextControl phone = new TextControl();
	private final LabelControl labelControl_3 = new LabelControl();
	private final TextControl email = new TextControl();
	private final LabelControl labelControl_4 = new LabelControl();
	private final TextAreaControl addressAreaControl = new TextAreaControl();
	private final NumericControl id = new NumericControl();
	private final LabelControl labelControl_7 = new LabelControl();
	
	public ClientForm() {
		jbInit();
	}
	
	private void jbInit() {
		
		setBorder(new TitledBorder(null, "\u0414\u0430\u043D\u043D\u044B\u0435 \u043A\u043B\u0438\u0435\u043D\u0442\u0430", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		GridBagLayout gbl_form = new GridBagLayout();
		gbl_form.columnWidths = new int[] {0, 204, 101, 0, 0, 0};
		gbl_form.rowHeights = new int[] {40, 40, 40, 40, 40, 58, 30, 0};
		gbl_form.columnWeights = new double[]{0.0, 1.0, 0.0, 1.0, 1.0, Double.MIN_VALUE};
		gbl_form.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE};
		setLayout(gbl_form);
		
		GridBagConstraints gbc_labelControl_7 = new GridBagConstraints();
		gbc_labelControl_7.anchor = GridBagConstraints.WEST;
		gbc_labelControl_7.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_7.gridx = 0;
		gbc_labelControl_7.gridy = 0;
		labelControl_7.setText("\u041D\u043E\u043C\u0435\u0440");
		add(labelControl_7, gbc_labelControl_7);
		
		GridBagConstraints gbc_id = new GridBagConstraints();
		gbc_id.insets = new Insets(0, 0, 5, 5);
		gbc_id.fill = GridBagConstraints.HORIZONTAL;
		gbc_id.gridx = 1;
		gbc_id.gridy = 0;
		add(id, gbc_id);
		id.setDecimals(0);
		
		
		GridBagConstraints gbc_labelControl = new GridBagConstraints();
		gbc_labelControl.anchor = GridBagConstraints.WEST;
		gbc_labelControl.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl.gridx = 0;
		gbc_labelControl.gridy = 1;
		add(labelControl, gbc_labelControl);
		labelControl.setText("\u0424\u0418\u041E");
		
		
		GridBagConstraints gbc_name = new GridBagConstraints();
		gbc_name.insets = new Insets(0, 0, 5, 5);
		gbc_name.fill = GridBagConstraints.HORIZONTAL;
		gbc_name.gridx = 1;
		gbc_name.gridy = 1;
		add(name, gbc_name);
		
		
		labelControl_5.setText("\u041F\u043E\u043B");
		GridBagConstraints gbc_labelControl_5 = new GridBagConstraints();
		gbc_labelControl_5.anchor = GridBagConstraints.WEST;
		gbc_labelControl_5.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_5.gridx = 2;
		gbc_labelControl_5.gridy = 1;
		add(labelControl_5, gbc_labelControl_5);
		
		
		GridBagConstraints gbc_comboBoxControl = new GridBagConstraints();
		gbc_comboBoxControl.insets = new Insets(0, 0, 5, 5);
		gbc_comboBoxControl.fill = GridBagConstraints.BOTH;
		gbc_comboBoxControl.gridx = 3;
		gbc_comboBoxControl.gridy = 1;
		add(sexControl, gbc_comboBoxControl);
		
		
		GridBagConstraints gbc_labelControl_1 = new GridBagConstraints();
		gbc_labelControl_1.anchor = GridBagConstraints.WEST;
		gbc_labelControl_1.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_1.gridx = 0;
		gbc_labelControl_1.gridy = 2;
		add(labelControl_1, gbc_labelControl_1);
		labelControl_1.setText("\u041F\u0430\u0441\u043F\u043E\u0440\u0442");
		
		
		GridBagConstraints gbc_passport = new GridBagConstraints();
		gbc_passport.insets = new Insets(0, 0, 5, 5);
		gbc_passport.fill = GridBagConstraints.BOTH;
		gbc_passport.gridx = 1;
		gbc_passport.gridy = 2;
		add(passport, gbc_passport);
		
		
		labelControl_6.setText("\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u043D\u043D\u0438\u044F");
		GridBagConstraints gbc_labelControl_6 = new GridBagConstraints();
		gbc_labelControl_6.anchor = GridBagConstraints.WEST;
		gbc_labelControl_6.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_6.gridx = 2;
		gbc_labelControl_6.gridy = 2;
		add(labelControl_6, gbc_labelControl_6);
		
		
		GridBagConstraints gbc_dateControl = new GridBagConstraints();
		gbc_dateControl.fill = GridBagConstraints.HORIZONTAL;
		gbc_dateControl.insets = new Insets(0, 0, 5, 5);
		gbc_dateControl.gridx = 3;
		gbc_dateControl.gridy = 2;
		add(dateControl, gbc_dateControl);
		dateControl.setDateType(Consts.TYPE_DATE);
		dateControl.setFormat(Resources.YMD);
		
		
		GridBagConstraints gbc_labelControl_2 = new GridBagConstraints();
		gbc_labelControl_2.anchor = GridBagConstraints.WEST;
		gbc_labelControl_2.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_2.gridx = 0;
		gbc_labelControl_2.gridy = 3;
		add(labelControl_2, gbc_labelControl_2);
		labelControl_2.setText("\u0422\u0435\u043B\u0435\u0444\u043E\u043D");
		
		
		GridBagConstraints gbc_phone = new GridBagConstraints();
		gbc_phone.insets = new Insets(0, 0, 5, 5);
		gbc_phone.fill = GridBagConstraints.BOTH;
		gbc_phone.gridx = 1;
		gbc_phone.gridy = 3;
		add(phone, gbc_phone);
		
		
		GridBagConstraints gbc_labelControl_3 = new GridBagConstraints();
		gbc_labelControl_3.anchor = GridBagConstraints.WEST;
		gbc_labelControl_3.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_3.gridx = 2;
		gbc_labelControl_3.gridy = 3;
		add(labelControl_3, gbc_labelControl_3);
		labelControl_3.setText("\u042D\u043B. \u043F\u043E\u0447\u0442\u0430");
		
		
		GridBagConstraints gbc_email = new GridBagConstraints();
		gbc_email.gridwidth = 2;
		gbc_email.insets = new Insets(0, 0, 5, 0);
		gbc_email.fill = GridBagConstraints.BOTH;
		gbc_email.gridx = 3;
		gbc_email.gridy = 3;
		add(email, gbc_email);
		
		
		labelControl_4.setText("\u0410\u0434\u0440\u0435\u0441");
		GridBagConstraints gbc_labelControl_4 = new GridBagConstraints();
		gbc_labelControl_4.anchor = GridBagConstraints.WEST;
		gbc_labelControl_4.gridheight = 2;
		gbc_labelControl_4.insets = new Insets(5, 5, 5, 5);
		gbc_labelControl_4.gridx = 0;
		gbc_labelControl_4.gridy = 4;
		add(labelControl_4, gbc_labelControl_4);
		
		
		GridBagConstraints gbc_addressAreaControl = new GridBagConstraints();
		gbc_addressAreaControl.gridheight = 2;
		gbc_addressAreaControl.gridwidth = 4;
		gbc_addressAreaControl.insets = new Insets(0, 0, 5, 0);
		gbc_addressAreaControl.fill = GridBagConstraints.BOTH;
		gbc_addressAreaControl.gridx = 1;
		gbc_addressAreaControl.gridy = 4;
		add(addressAreaControl, gbc_addressAreaControl);
		
		setVOClassName("src.VO.ClientVO");
		sexControl.setDomainId("SEX");
		
		
		addressAreaControl.setAttributeName(ClientVO.getAddressString());
		phone.setAttributeName(ClientVO.getPhoneString());
		email.setAttributeName(ClientVO.getEmailString());
		id.setAttributeName(ClientVO.getIdString());
		passport.setAttributeName(ClientVO.getPassportString());
		name.setAttributeName(ClientVO.getNameString());
		dateControl.setAttributeName(ClientVO.getDateBString());
		sexControl.setAttributeName(ClientVO.getSexString());
		
		
	}

	public DateControl getDateControl() {
		return dateControl;
	}
}
